<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <body>
    <div id="content">houdunren.com</div>
  </body>
  <script>
    const content = prompt("请输入要搜索的内容，支持正则表达式");
    const reg = new RegExp(content, "g");
    let body = document
      .querySelector("#content")
      .innerHTML.replace(reg, str => {
        return `<span style="color:red">${str}</span>`;
      });
    document.body.innerHTML = body;
  </script>
</body>
</html>